package com.kly.enums;

public enum Region {
    isnull(0,"非法参数"),

    USA(1,"美国")


    ;

    private int code;

    private String comment;

    Region(int code, String comment) {
        this.code = code;
        this.comment = comment;
    }

    public int getCode() {
        return code;
    }

    public String getComment() {
        return comment;
    }

    public static Region region(int type) {
        if (type==0){
            return isnull;
        }
        for (Region region : values()) {
            if (region.getCode() == type) {
                return region;
            }
        }
        return isnull;
    }
}
